<template>
    <div class="goods-list">
        <div class="goods-item" v-for="item in goodsList" :key="item.src">
            <img :src="item.src" alt="">
            <h3>{{item.name}}</h3>
            <div class="info">
                <p class="price">
                    <span class="new-price">￥{{item.price}}</span>
                    <span class="old-price">{{item.oldPrice}}</span>
                </p>
                <p class="status">
                    <span>{{item.status}}</span>
                    <span>库存：{{item.reserve}}</span>
                </p>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            goodsList:[
                {src:'https://m.360buyimg.com/babel/jfs/t1/5479/8/3546/70556/5b997c0cE40f64978/6540f1c2a6090257.jpg!q70.jpg',name:'荣耀V20 游戏手机 麒麟980芯片 魅眼全视屏 4800万深感相机 6GB+128GB 幻夜黑 移动联通电信4G全面屏手机',price:'2099.00',oldPrice:'2499',status:'热卖中',reserve:'999'},
                {src:'https://m.360buyimg.com/babel/jfs/t1/1468/11/3377/138213/5b997bf3Eda5b24a4/0ace3ed19582dbe6.jpg!q70.jpg',name:'Apple iPhone XS (A2100) 64GB 金色 移动联通电信4G手机',price:'7399.00',oldPrice:'7499',status:'热卖中',reserve:'999'},
                {src:'https://m.360buyimg.com/babel/jfs/t1/41069/14/5268/224755/5ceb4b2dE509aca2c/c57bbc4a52f3f8ee.jpg!q70.jpg',name:'小米 Redmi K20Pro 4800万超广角三摄 8GB+256GB 碳纤黑 骁龙855 全网通4G 双卡双待 全面屏拍照智能游戏手机',price:'2999.00',oldPrice:'3499',status:'热卖中',reserve:'999'},
            ]
        }
    }
}   
</script>
<style lang="scss" scoped>
    .goods-list{
        display: flex;
        flex-wrap: wrap;
        padding: 7px;
        justify-content: space-between;
        .goods-item{
            width: 49%;            
            margin: 4px 0;
            border: 1px solid #ccc;
            border-radius: 5px ;
            box-shadow: 0 0 9px #ccc;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 2px;
            img{
                width: 100%;
                max-height: 164px;
            }
            h3{
                font-size: 14px;
                max-height: 42px;
                overflow: hidden;
            }
            .info{
                background-color: #eee;
                
                .price{
                    padding:0 10px;
                    .new-price{
                        color: red;
                        font-weight: bold;
                        font-size: 18px;
                        
                    }
                    .old-price{
                        margin:0 10px;
                        text-decoration: line-through;
                    }
                }
                .status{
                    padding: 0 10px;
                    display: flex;
                    justify-content: space-between;
                }
            }
        }
        
    }
</style>